package com.aistar.service.impl;

import com.aistar.mapper.AtentionMapper;
import com.aistar.mapper.MemberMapper;
import com.aistar.mapper.RewardMapper;
import com.aistar.mapper.TravelnoteMapper;
import com.aistar.pojo.Member;
import com.aistar.pojo.Reward;
import com.aistar.pojo.Travelnote;
import com.aistar.pojo.TravelnoteExample;
import com.aistar.service.MyHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class MyHomeServiceImpl implements MyHomeService {
    @Autowired
    private RewardMapper rewardMapper;
    @Autowired
    private AtentionMapper atentionMapper;
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
    private TravelnoteMapper travelnoteMapper;

    @Override
    public int selectByUserIdNumber(Integer userid) {
        return atentionMapper.selectByUserIdNumber(userid);
    }

    @Override
    public int selectByAtenIdNumber(Integer atenid) {
        return atentionMapper.selectByAtenIdNumber(atenid);
    }

    @Override
    public Member selectByPrimaryKey(Integer userId) {
        return memberMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int deleteByKey(int travelid) {
        System.out.println("travelid:"+travelid);
        Travelnote travelnote = travelnoteMapper.selectByPrimaryKey(travelid);
        travelnote.setTravStatus(0);
        int t = travelnoteMapper.updateByPrimaryKey(travelnote);
       return t;
    }


}
